<?php
    function DisplayAdvertiser()
    {
        global $myCon;
        // Query all advertiser from the database
        $result = $myCon->Query("SELECT advertiser.advertiser_id, name,address, url_destination, creation_date, city, state,
                        country, rating, total_ratings FROM advertiser LEFT JOIN fivestars ON advertiser.advertiser_id=fivestars.advertiser_id");
        if (mysql_num_rows($result))
        {
            $oTable = new Table('advertiser');
            while ($row = mysql_fetch_object($result))
            {
                $oTable->NewLine();
                $oTable->NewCol();
                $oTable->Write($row->name);
                $oTable->CloseCol();
                $oTable->NewCol();
                $oTable->Write($row->address);
                $oTable->CloseCol();
                $oTable->NewCol(NULL, 'DisplayRating', $row->advertiser_id);
                $oTable->CloseCol();
                $oTable->CloseLine();
            }
            mysql_free_result($result);
            $oTable->CloseTable();
            echo $oTable->PrintTable();
        }
        else
        {
            echo 'No records';
        }
    }
?>